package com.hxzy.projectssmplus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzy.projectssmplus.dto.SysDicTypeDTO;
import com.hxzy.projectssmplus.entity.SysDictType;
import com.hxzy.projectssmplus.mapper.SysDictDataMapper;
import com.hxzy.projectssmplus.mapper.SysDictTypeMapper;
import com.hxzy.projectssmplus.service.SysAdminUserService;
import com.hxzy.projectssmplus.service.SysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper,SysDictType> implements SysDictTypeService {

    @Autowired
    private SysDictTypeMapper sysDictTypeMapper;

    @Override
    public IPage<SysDictType> searchByXML(IPage iPage,SysDicTypeDTO sysDicTypeDTO) {
        List<SysDictType> sysDictTypes = this.sysDictTypeMapper.searchByXML(iPage,sysDicTypeDTO);
        iPage.setRecords(sysDictTypes);
        return iPage;
    }

    @Override
    public Integer insertDict(SysDictType sysDictType) {
        int insert = this.sysDictTypeMapper.insert(sysDictType);

        return insert;
    }

    @Override
    public Integer delateDict(List idList) {
        int i = this.sysDictTypeMapper.deleteBatchIds(idList);

        return i;
    }

    @Override
    public int delateOne(long id) {
        int i = this.sysDictTypeMapper.deleteById(id);
        return i;
    }

    @Override
    public Integer dictUpdate(SysDictType sysDictType) {
        int i = this.sysDictTypeMapper.updateById(sysDictType);
        return i;
    }

    @Override
    public List<SysDictType> searType() {
        QueryWrapper<SysDictType> queryWrapper=new QueryWrapper<>();
        List<SysDictType> sysDictTypes = this.sysDictTypeMapper.selectList(queryWrapper);
        return sysDictTypes;
    }


}
